package com.vignando.avaliador.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.vignando.avaliador.model.Password;
import com.vignando.avaliador.model.Score;

@WebServlet("/avaliadorController")
public class AvaliadorController extends HttpServlet {
	private static final long serialVersionUID = 1L;

	public AvaliadorController() {
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		String strPassword = request.getParameter("password");
		response.setContentType("text/html");
		PrintWriter out = response.getWriter();
		
		Password password = new Password(strPassword);
		Score score = new Score(password);
		
		out.println(score.resultado());
		out.close();
	}

}
